vt-d: do not enable VT-d on acpi=off
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 19 Oct 2009 09:57:58 +0000 (10:57 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 19 Oct 2009 09:57:58 +0000 (10:57 +0100)
This reverts changeset 20323: 2370e16ab6d3 and adds a small
check to iommu_setup() which should more correctly cover all cases.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/vtd/intremap.c
xen/drivers/passthrough/vtd/iommu.c

index b1ce67f7415a4e0c9b6975fe5a80b4171c4a19d4..9f5c40f5e0f50ba5c3ca7be9729d2c5c4103566e 100644 (file)
@@ -266,9 +266,13 @@ int iommu_setup(void)
 {
     int rc = -ENODEV;
 
-    rc = iommu_hardware_setup();
-
-    iommu_enabled = (rc == 0);
+    if ( acpi_disabled )
+        iommu_enabled = 0;
+    else
+    {
+        rc = iommu_hardware_setup();
+        iommu_enabled = (rc == 0);
+    }
 
     if ( force_iommu && !iommu_enabled )
         panic("IOMMU setup failed, crash Xen for security purpose!\n");
index 595afbaa1e50689661f49bafb8108d993ba6c603..bad38ff7d3acb5ff16976076a725adbadec313e0 100644 (file)
@@ -575,8 +575,7 @@ void msi_msg_read_remap_rte(
     struct iommu *iommu = NULL;
     struct ir_ctrl *ir_ctrl;
 
-    if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
-        return;
+    drhd = acpi_find_matched_drhd_unit(pdev);
     iommu = drhd->iommu;
 
     ir_ctrl = iommu_ir_ctrl(iommu);
@@ -594,8 +593,7 @@ void msi_msg_write_remap_rte(
     struct iommu *iommu = NULL;
     struct ir_ctrl *ir_ctrl;
 
-    if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
-        return;
+    drhd = acpi_find_matched_drhd_unit(pdev);
     iommu = drhd->iommu;
 
     ir_ctrl = iommu_ir_ctrl(iommu);
index af611a9d40c076278ccfd39e2ff69790af318590..5cc69e98c75912c38122e44dcc8b8165e8f90c43 100644 (file)
@@ -1349,8 +1349,7 @@ static int reassign_device_ownership(
     if (!pdev)
         return -ENODEV;
 
-    if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
-        return -ENODEV;
+    drhd = acpi_find_matched_drhd_unit(pdev);
     pdev_iommu = drhd->iommu;
     domain_context_unmap(source, bus, devfn);
 
@@ -1364,7 +1363,7 @@ static int reassign_device_ownership(
     for_each_pdev ( source, pdev )
     {
         drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd && drhd->iommu == pdev_iommu )
+        if ( drhd->iommu == pdev_iommu )
         {
             found = 1;
             break;